<%@ page language="java" pageEncoding="UTF-8"%>


<script type="text/javascript">
   $(function(){
	  
	   jQuery("#zzld-index-nav").accordion({ //初始化accordion
           fillSpace:true,
           fit:true,
           border:false,
           animate:false  
     });
     $.post("${ctx}/autoinn/wxfacilitator/res/getres", { "pid": "null" }, function (data) {
              $.each(data, function (i, e) {//循环创建手风琴的项
                  var id = e.id;
                  $('#zzld-index-nav').accordion('add', {
                      title: e.text,
                      content: "<ul id='tree"+id+"' ></ul>",
                      selected: true
                      //iconCls:e.iconCls //e.Icon                       
                 });
                  $.parser.parse();
                  $.post("${ctx}/autoinn/wxfacilitator/res/getres",{"pid":id},function(data) {//循环创建树的项
                      $("#tree" + id).tree({
                   	   idFiled:'id',
                   	   textFiled:'name',
                   	   parentField :'pid',
                   	   attributes : 'attributes',
                          data: data,
                          onBeforeExpand:function(node,param){  
                            //  $("#tree" + id).tree('options').url = "${ctx}/sys/roleRes/getUserResTreeById?id=" + node.id;
                          },   
                          onClick : function(node){  
                       	   var url=node.attributes.url;
                       	   var tabTitle=node.text;
                       	   if(url!=null){
                       		   createTab(tabTitle,ctx+url, '', true);
                       	   }
                       	  
                          }
                      });
                  }, 'json');
              });

   });
   });
</script>

<div id="zzld-index-nav" class="easyui-accordion" fit=true border=false>

</div>

